package com.wuxiaofan.coupon.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.coupon.entity.SmsSeckillPromotion;
import com.wuxiaofan.coupon.entity.custom.SmsSeckillPromotionCustom;
import com.wuxiaofan.coupon.mapper.SmsSeckillPromotionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.coupon.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SmsSeckillPromotionService {
    @Autowired
    private SmsSeckillPromotionMapper smsSeckillPromotionMapper;
    @Resource
    private Idgenerator idgenerator;
    public SmsSeckillPromotion findById(String id){
        return smsSeckillPromotionMapper.selectById(id);
    }

    public SmsSeckillPromotionCustom findCountByMap(Map paraMap){
        return smsSeckillPromotionMapper.findCountByMap(paraMap);
    }

    public SmsSeckillPromotionCustom findGroupByMap(Map paraMap){
        return smsSeckillPromotionMapper.findGroupByMap(paraMap);
    }

    public List<SmsSeckillPromotionCustom> findByMap(Map paraMap){
        return smsSeckillPromotionMapper.findByMap(paraMap);
    }

    public Page<SmsSeckillPromotionCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(smsSeckillPromotionMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        smsSeckillPromotionMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        smsSeckillPromotionMapper.deleteById(id);
    }

    public SmsSeckillPromotion save(SmsSeckillPromotion smsSeckillPromotion){
        smsSeckillPromotion.setId(idgenerator.getId());
        smsSeckillPromotionMapper.insert(smsSeckillPromotion);
        return smsSeckillPromotion;
    }

}
